import re
data = r'''rule 10 permit vpn-instance NET-manage source 10.253.24.134 0
 rule 11 permit vpn-instance NET-manage source 10.253.24.135 0
 rule 12 permit vpn-instance NET-manage source 10.253.24.136 0
 rule 13 permit vpn-instance NET-manage source 10.11.98.98 0
 rule 14 permit vpn-instance NET-manage source 10.11.98.99 0
 rule 15 permit vpn-instance NET-manage source 10.0.0.254 0
 rule 16 permit vpn-instance NET-manage source 192.168.116.44 0.0.0.3
 rule 17 permit vpn-instance NET-manage source 192.168.116.48 0.0.0.7
 rule 18 permit vpn-instance NET-manage source 192.168.28.116 0.0.0.3'''
# 取配置中所有可能的IP段
IpAddress = list()
result = re.findall(r"\s(\d+\.\d+\.\d+\.\d+) mask (\d+|\d+\.\d+\.\d+\.\d+)\s", data)
for res in result:
    IpAddress.append(" ".join(res))
result = re.findall(r"\s(\d+\.\d+\.\d+\.\d+)/(\d+|\d+\.\d+\.\d+\.\d+)\s", data)
for res in result:
    IpAddress.append(" ".join(res))
result = re.findall(r"\s([A-Z0-9:]+:[A-Z0-9:]*)/(\d+)\s", data)
for res in result:
    IpAddress.append(" ".join(res))
result = re.findall(r"\s([A-Z0-9:]+:[A-Z0-9:]* \d+)\s", data)
IpAddress.extend(result)
result = re.findall(r"\s(\d+\.\d+\.\d+\.\d+ (?:\d+|\d+\.\d+\.\d+\.\d+))\s", data)
IpAddress.extend(result)
result = {"IpAddress":IpAddress}
result_json = json.dumps(result,indent=4,ensure_ascii=False)
print(result_json)